<!DOCTYPE html>
<html>
<head>
	<title></title>
	<meta charset="utf-8">
	<link rel="stylesheet" href="../../../../static/css/bootstrap.min.css">
	<link rel="stylesheet" href="../../../../static/css/ylb.css">
	<link rel="stylesheet" href="app.css">
	<link rel="shortcut icon" href="../../../../static/img/logo.png">
	<script type="text/javascript" src="../../../../static/js/jquery.min.js"></script>
	<script type="text/javascript" src="../../../../static/js/popper.min.js"></script>
	<script type="text/javascript" src="../../../../static/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="../../../../static/js/qrcode.min.js"></script>
	<script type="text/javascript" src="./app.js"></script>
</head>
<body>

<div id="app">
	
	<!-- 左侧 -->
	<div class="left">
		<div class="dhview">

			<!-- LOGO -->
			<a href="../../../index/" class="index">
			    <div class="logo"></div>
			</a>

			<!-- 导航 -->
			<ul>
			    <a href="../../../index/" >
			    <li class="nav-li">
			        <i class="icon i-data"></i>
			        <span class="nav-text">数据</span>
			    </li>
			    </a>
			    
			    <a href="../../../qun/">
			    <li class="nav-li">
			        <i class="icon i-hm"></i>
			        <span class="nav-text">活码</span>
			    </li>
			    </a>
			    
				<a href="../../../dwz/">
				<li class="nav-li">
				    <i class="icon i-dwz"></i>
				    <span class="nav-text">短网址</span>
				</li>
				</a>
				
				<a href="../../../tbk/">
				<li class="nav-li">
				    <i class="icon i-tbk"></i>
				    <span class="nav-text">淘宝客</span>
				</li>
				</a>
				
				<a href="../../../shareCard/">
				<li class="nav-li">
				    <i class="icon i-share"></i>
				    <span class="nav-text">分享卡片</span>
				</li>
				</a>
				
				<a href="../../../plugin/" class="selected">
				<li class="nav-li">
				    <i class="icon i-plugin-dark"></i>
				    <span class="nav-text">插件中心</span>
				</li>
				</a>
				
				<a href="../../../kami/">
				<li class="nav-li">
				    <i class="icon i-kami"></i>
				    <span class="nav-text">卡密分发</span>
				</li>
				</a>
				
				<a href="../../../config/">
				<li class="nav-li">
				    <i class="icon i-config"></i>
				    <span class="nav-text">配置中心</span>
				</li>
				</a>
				
				<a href="../../../sucai/">
				<li class="nav-li">
				    <i class="icon i-sucai"></i>
				    <span class="nav-text">素材管理</span>
				</li>
				</a>
				
				<a href="../../../user/">
				<li class="nav-li">
				    <i class="icon i-account"></i>
				    <span class="nav-text">账号管理</span>
			    </li>
			    </a>
			</ul>

			<!-- 账号 -->
			<div class="account">加载中...</div>
		    
		</div>
	</div>

	<!-- 右侧 -->
	<div id="right">
	    
		<h3>
		    <a href="./" class="mianbaoxie_a">插件中心</a> ➜ <span class="mbx">支付宝赚赏金单页</span> 
	    </h3>
		<div class="data-card">
		    
			<!-- 按钮区域 -->
			<div class="button-view" id="button-view" style="display:none;">
			    
				<!--返回按钮-->
    			<a href="../../">
    			    <div class="back-lastpage"></div>
    			</a>
			</div>

			<!-- 数据列表或其它需要正常展示的内容 -->
			<div class="data-list" style="display:none;">
				
				<br/>
				<div class="alipayShangJin">
				<form id="alipayShangJin" enctype="multipart/form-data">
				    
				    <span class="text">单页标题</span>
                    <input type="text" name="alipayShangJinSPA_title" class="form-control" autocomplete="off" placeholder="单页标题">
                    
                    <span class="text">单页摘要</span>
                    <input type="text" name="alipayShangJinSPA_desc" class="form-control" autocomplete="off" placeholder="单页摘要">
                    
                    <span class="text">支付宝商家uid</span>
                    <input type="text" name="alipayShangJinSPA_uid" class="form-control" autocomplete="off" placeholder="支付宝商家uid">
                    
                    <span class="text">背景图</span>
                    <div class="uploadForm">
                        <div class="inputView">
                            <input type="text" name="alipayShangJinSPA_bgImg" class="form-control" autocomplete="off" placeholder="上传或粘贴图片链接">
                        </div>
                        <div class="imgSelect">
                            <input type="file" class="fileSelect" id="fileSelect" name="file" />
                            <span>上传图片</span>
                        </div>
                    </div>
                    
                    <span class="text">支付宝赏金二维码Token</span>
                    <input type="text" name="alipayShangJinSPA_token" class="form-control" autocomplete="off" placeholder="支付宝赏金二维码Token">
                    
                    <span class="text">搜索码</span>
                    <input type="text" name="alipayShangJinSPA_hbm" class="form-control" autocomplete="off" placeholder="红包搜索码">
                    
                    <button type="button" class="default-btn alipayShangJin-tijiao" onclick="editAlipayShangJin();">提交配置</button>
                    <a href="img/参数获取教程.docx" class="alink" target="blank">参数配置说明</a>
                    
                    <!--操作结果-->
                    <div class="ret-text"></div>
				</form>
				</div>
			</div>
			
			<!--没有数据、加载数据失败、加载中，等情况将模板渲染到这里-->
			<p class="loading" style="display: none;"></p>
			
			<!-- 分页组件 -->
			<div class="fenye"></div>
			
		</div><!-- data-card -->
	</div><!-- right -->

    <!-- 全局信息提示框 -->
    <div id="notification">
        <div id="notification-text"></div>
    </div>

</div><!-- app -->

<script>
    
    // 上传
    $("#fileSelect").change(function(e){
        
        // 获取选择的文件
        var fileSelect = e.target.files;
        if(fileSelect.length>0){
            
            // file表单数据
            var imageData = new FormData(document.getElementById("alipayShangJin"));
            
            // 异步上传
            $.ajax({
                url:"../../../upload.php",
                type: "POST",
                data: imageData,
                cache: false,
                processData: false,
                contentType: false,
                success: function(res) {
                    
                    if(res.code == 200){
                        
                        // 上传成功
                        $('input[name="alipayShangJinSPA_bgImg"]').val(res.url);
                        $('#alipayShangJin .imgSelect span').text('已上传')
                    }else{
                        
                        // 上传失败
                        $('#alipayShangJin .imgSelect span').text('上传失败')
                    }
                },
                error: function() {
                    
                    // 上传失败
                    $('.ret-text').html('<p class="error">服务器发生错误</p>');
                },
                beforeSend: function(res){
                
                    // 上传中
                    $('#alipayShangJin .imgSelect span').text('上传中...')
                }
            })
        }
    })
    
    // 提交配置
    function editAlipayShangJin() {
        
        $.ajax({
            type: "POST",
            url: "server/editAlipayShangJin.php",
            data: $('#alipayShangJin').serialize(),
            success: function(res){
                
                // 成功
                if(res.code == 200) {
                    
                    $('.ret-text').html('<p class="success">'+res.msg+'</p>');
                    setTimeout(function(){
                        location.reload();
                    },2000);
                }else {
                    
                    $('.ret-text').html('<p class="error">'+res.msg+'</p>');
                }
                
            },
            error: function() {
                
                // 服务器发生错误
                $('.ret-text').html('<p class="error">服务器发生错误</p>');
            }
        });
    }

</script>
</body>
</html>